<script setup lang="ts" name="PopoverProperty">
import { PopoverProperty } from './config'
import { usePropertyForm } from '@/components/Designer/utils/index'

// 弹窗广告属性面板

const props = defineProps<{ modelValue: PopoverProperty }>()
const emit = defineEmits(['update:modelValue'])
const { formData } = usePropertyForm(props.modelValue, emit)
</script>

<template>
  <ElForm label-width="80px" :model="formData">
    <Draggable v-model="formData.list" :empty-item="{ showType: 'once' }">
      <template #default="{ element, index }">
        <ElFormItem label="图片" :prop="`list[${index}].imgUrl`">
          <UploadImage v-model="element.imgUrl" height="56px" width="56px" />
        </ElFormItem>
        <ElFormItem label="跳转链接" :prop="`list[${index}].url`">
          <MallAppLinkInput v-model="element.url" />
        </ElFormItem>
        <ElFormItem label="显示次数" :prop="`list[${index}].showType`">
          <ElRadioGroup v-model="element.showType">
            <ElTooltip content="只显示一次，下次打开时不显示" placement="bottom">
              <ElRadio label="once">一次</ElRadio>
            </ElTooltip>
            <ElTooltip content="每次打开时都会显示" placement="bottom">
              <ElRadio label="always">不限</ElRadio>
            </ElTooltip>
          </ElRadioGroup>
        </ElFormItem>
      </template>
    </Draggable>
  </ElForm>
</template>

<style scoped lang="scss"></style>
